﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SampleWinProject.DesignPartten.Observer
{
    class CurrentConditionsDisplay:DisplayElement, Observer 
    {
        private float temp, humidity;
        private Subject weatherData;

        public CurrentConditionsDisplay(Subject watherData)
        {
            this.weatherData = watherData;
            weatherData.RegisterObserver(this);
        }
        #region DisplayElement Members

        public void Display()
        {

            Console.Write("Current Conditions:" + temp + "F degress and " + humidity + "% humidity");
        }

        #endregion

        #region Observer Members

        public void Update(float temp, float humdity, float pressure)
        {
            this.temp = temp;
            this.humidity = humidity;
            Display();
        }

        #endregion
    }
}
